<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateArticlesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('articles', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title',100)->comment('文章标题');
            $table->unique('title');
            $table->string('description',255)->comment('文章描述');
            $table->string('thumb',255)->ablenull()->comment('缩略图');
            $table->longText('content')->comment('内容');
            $table->string('author',45)->comment('作者');
            $table->unsignedInteger('view_times')->comment('浏览次数');
            $table->boolean('recommend')->comment('推荐');
            $table->boolean('show_status')->comment('是否展示');
            $table->boolean('essence')->comment('精华');
            $table->unsignedInteger('cate_id')->comment('文章所属分类id');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('articles');
    }
}
